import Http from '@/http';
import { dictionaryItemByCategoryApi } from './system/Dictionary';

export function saveApi(params:any) {
    return params.id ? Http.put('token/update/' + params.id, params) : Http.post('token/add', params)
}

export function pageApi(params:any) {
    return Http.post('token/page', params)
}

export function deleteApi(id) {
    return Http.delete('token/delete/' + id)
}

export function uploadApi(file:File) {
    const formData = new FormData()
    formData.append('icon', file)
    return Http.post('token/upload', formData)
}


export async function tokenTypeApi() {
    const r = await dictionaryItemByCategoryApi('TOKEN_TYPE')
    return r.data
}

export async function tokenStandardApi() {
    const r = await dictionaryItemByCategoryApi('TOKEN_STANDARD')
    return r.data
}